Relational Operators are used to compare to operands (variables). These operators can compare any data type.
An example of usage is within an If statement. The condition is testing performing a test resulting in true or false. These operators determine who the condition is performed.
You should not try to compare differing data types using these operators. First convert both operands to be the same data type. Refer See "Conversion"
When using the less than or greater than operators against String data types it compares using alphabetical sorting. Eg 'abc' is less than 'ade'
Operator | Operation | Operand | Result | Example |
---|---|---|---|---|
= | Equal | Any Data Type | Boolean | if 'abc' = 'abc' then |
<> | Not Equal | Any Data Type | Boolean | if 3 <> 4 then |
< | Less Than | Any Data Type | Boolean | if X < Y then |
> | Greater Than | Any Data Type | Boolean | if 3 > 5 then |
<= | Less than or equal | Any Data Type | Boolean | if X <= Y then |
>= | Greater than or equal | Any Data Type | Boolean | if 5 >= 8 then |